package com.sxmd.myapplication;

import android.util.Log;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * Created by nakisaRen
 * on 16/9/2.
 */
public class StringData {
    private  String mDay;
    private  String mWay;

    private  List<Data> dataList = new ArrayList<>();
    private  String start = "09:00";
    private  String end = "12:00";
    private List<Prog> progs = new ArrayList<>();

    private static String[] time = new String[]{"07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "0", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "0", "19:00", "20:00", "21:00", "22:00"};

    public  LinkedHashMap getNextServenDays() {
        LinkedHashMap<String,String> linkedHashMap = new LinkedHashMap<>(7);
        for (int i = 0; i < 7; i++) {
            Calendar calendar = Calendar.getInstance();
            int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
            calendar.set(Calendar.DAY_OF_YEAR, dayOfYear + i);
            mDay = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH));
            mWay = String.valueOf(calendar.get(Calendar.DAY_OF_WEEK));
            if("1".equals(mWay)){
                mWay ="天";
            }else if("2".equals(mWay)){
                mWay ="一";
            }else if("3".equals(mWay)){
                mWay ="二";
            }else if("4".equals(mWay)){
                mWay ="三";
            }else if("5".equals(mWay)){
                mWay ="四";
            }else if("6".equals(mWay)){
                mWay ="五";
            }else if("7".equals(mWay)){
                mWay ="六";
            }
            linkedHashMap.put(mDay,mWay);
            Log.v("rxf",mDay + "/" + linkedHashMap.get(mDay));
        }
        return linkedHashMap;
    }


    public String getMonth(){
        int month = Calendar.getInstance().get(Calendar.MONTH)+1;
        return month+"月";
    }
    /*public static void getTime(){
        List<Prog> list = new ArrayList<>();
        Prog prog = new Prog();
        for (int i = 0; i < 7; i++) {
            Calendar calendar = Calendar.getInstance();
            int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
            calendar.set(Calendar.DAY_OF_YEAR, dayOfYear + i);
            mDay = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH));
            prog.setDay(mDay);
            for (int j = 0; j < time.length; j++) {
                if(start.equals(time[j])){
                    prog.setStartTime(j);
                }
                if(end.equals(time[j])){
                    prog.setEndTime(j);
                }
            }
        list.add(prog);
        }
        for (int i = 0; i < list.size(); i++) {
            Log.v("rxf",list.get(i).getDay() + "/" + list.get(i).getStartTime() + "/" + list.get(i).getEndTime());
        }
    }*/


    public void initData(){
        for (int i = 1; i <= 7; i++) {
            String day = i + "";
            List<Time> times = new ArrayList<>();
            Time time = new Time("09:00","15:00");
            Time timeN = new Time("17:00","19:00");
            times.add(time);
            times.add(timeN);
            Data data = new Data(day,times);
            dataList.add(data);
        }
    }

    public List<Prog> getTT(){
        for (int i = 0; i < dataList.size(); i++) {
            for (int j = 0; j < dataList.get(i).getTimes().size(); j++) {
                Time time1 = dataList.get(i).getTimes().get(j);
                Prog prog = new Prog();
                prog.setDay(i);
                for (int k = 0; k < time.length; k++) {
                    if(time1.getStartTime().equals(time[k])){
                        prog.setStartTime(k);
                    }
                    if(time1.getEndTime().equals(time[k])){
                        prog.setEndTime(k);
                    }
                }
                progs.add(prog);
            }
        }
        return progs;
    }



}
